<?php
/**
 * licenses : MIT
 * creatTime: 2020/5/13
 * author : weblinuxgame
 * filename: NotFoundHandler.php
 */

namespace App\Exceptions\Api;

use Throwable;
use App\Core\Utils\Message;
use App\Core\Traits\Api\ApiResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
 * 路由正常错误处理
 * Class NotFoundHandler
 * @package App\Exceptions\Api
 */
class NotFoundHandler
{
    use ApiResponse;

    public static function IsNotFoundException(Throwable $e)
    {
        if ($e instanceof NotFoundHttpException) {
            return true;
        }
        return false;
    }


    public function render($request, Throwable $exception)
    {
        return $this->failed(Message::ApiNotFoundMsg, Message::ApiNotFound);
    }
}
